home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mission 3
/
Mission 3.zip
/
Mission 3.iso
/
tools
/
facevalu
/
examples
/
zoomdemo
/
userwork.lst
next >
Wrap
File List
|
1998-03-29
|
5KB
|
138 lines
'
' *** Routines written for the Zoom Wrinkle demo (commented): ***
> PROCEDURE my_zoom(index&)
LOCAL tree%,x&,y&,w&,h&,factor&
' first, find the adress of the tree:
tree%=@xrsrc_gaddr(0,zoom_dialog&)
' then check the popup (zoomfactor) value & set the w/h and true factor accordingly:
SELECT zoom_factor_var& !the zoom factor popup value
CASE 1 !zoom factor = 4
factor&=4
w&=64
h&=64
CASE 2 !zoom factor = 8
factor&=8
w&=32
h&=32
CASE 3 !zoom factor = 16
factor&=16
w&=16
h&=16
ENDSELECT
' then get the placement of the "thumb":
x&=OB_X(tree%,zoom_drag&)
y&=OB_Y(tree%,zoom_drag&)
' zoom it:
@mono_zoom(LPEEK(OB_SPEC(tree%,from_here&)),16,x&,y&,w&,h&,LPEEK(OB_SPEC(tree%,zoom_here&)),32,factor&)
' redraw if neccesary:
IF index&<>-1
@rsc_ob_draw(index&,zoom_here&)
ENDIF
RETURN
> PROCEDURE my_resize_thumb(index&)
LOCAL tree%
' first, find the adress of the tree:
tree%=@xrsrc_gaddr(0,zoom_dialog&)
' then check the popup (zoomfactor) value & set the size of the "thumb" (outline) accordingly:
SELECT zoom_factor_var& !the zoom factor popup value
CASE 1 !zoom factor = 4
OB_W(tree%,zoom_drag&)=64
OB_H(tree%,zoom_drag&)=64
CASE 2 !zoom factor = 8
OB_W(tree%,zoom_drag&)=32
OB_H(tree%,zoom_drag&)=32
CASE 3 !zoom factor = 16
OB_W(tree%,zoom_drag&)=16
OB_H(tree%,zoom_drag&)=16
ENDSELECT
' now make sure the "thumb" is contained within the drawing:
OB_X(tree%,zoom_drag&)=MIN(OB_X(tree%,zoom_drag&),SUB(SUB(OB_W(tree%,from_here&),OB_W(tree%,zoom_drag&)),2))
OB_Y(tree%,zoom_drag&)=MIN(OB_Y(tree%,zoom_drag&),SUB(SUB(OB_H(tree%,from_here&),OB_H(tree%,zoom_drag&)),2))
' redraw if neccesary:
IF index&<>-1
@rsc_ob_draw(index&,from_here&)
ENDIF
RETURN
'
' *** Replace the two relevant FV-written "user_"-routines with these (commented): ***
> PROCEDURE user_on_open
'
' This procedure is called when the program is run, after the RSC is
' loaded and just before the main loop. You can open program windows,
' toolboxes etc. here, or init things for your program like
' loading an *.INF or .DAT file.
'
' If run as an accessory, this procedure is called EVERY TIME
' THE ACCESSORY IS OPENED. If you need to do anything just ONCE,
' like disable menu-entries spesific to PROGRAM execution, set a global
' flag here to avoid doing things EVERY time the accessory is opened.
'
' ΩΩwsnippetΩΩ - Wrinkle code: (don't change or delete this flag)
' ΩΩwsnippetΩΩ - End of Wrinkle code: (don't change or delete this flag)
'
' initialize the "thumb" and placement:
@my_resize_thumb(-1)
' initialize the zoom:
@my_zoom(-1)
'
'
RETURN
> PROCEDURE user_rsc_interact(index&,tree&,object&,mc&,sub_me&)
'
' <index&> is the index of this window in window_array&(index&,x)
' If the object tree is the normal menu bar, <index&>=-1
' <tree&> is the object tree number
' <object&> is the object that was selected (clicked on OR shortcut)
' <mc&> is the number of clicks (1=normal/2=double clicked/1 if shortcut)
' <sub_me&> is the chosen menuitem in a popup menu
'
SELECT tree&
'
' ------------------------------------------------------------------------
'
CASE menu&
SELECT object&
CASE about&
~@alert_standard(1,about_alert&,"") !just an about-alert
CASE dialog_open&
~@win_open_dialog(-1,zoom_dialog&,-1) !open the zoom dialog
CASE dialog_close&
@win_close(@find_handle_from_tree(zoom_dialog&)) !close the zoom dialog
CASE demo_quit&
exit_program!=TRUE
ENDSELECT
'
' ------------------------------------------------------------------------
'
CASE zoom_dialog&
SELECT object&
CASE zoom_drag&
@my_zoom(index&) !the "thumb" is moved, so update the zoom
CASE zoom_close&
@win_close(@find_handle_from_tree(zoom_dialog&)) !close the zoom dialog
CASE zoom_factor&
@my_resize_thumb(index&) !the zoom factor is changed, so resize
@my_zoom(index&) !the "thumb" & update the zoom
CASE zoom_more&
~@win_open_dialog(-1,zoom_explain&,-1) !open the explanation dialog
ENDSELECT
'
'
' ------------------------------------------------------------------------
'
CASE zoom_explain&
SELECT object&
CASE explain_close&
@win_close(@find_handle_from_tree(zoom_explain&)) !close the explanation dialog
ENDSELECT
'
' ------------------------------------------------------------------------
'
'
' ΩΩwsnippetΩΩ - Wrinkle code: (don't change or delete this flag)
' ΩΩwsnippetΩΩ - End of Wrinkle code: (don't change or delete this flag)
'
ENDSELECT
RETURN
'